package org.apache.elasticjob.config;

import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration;
import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ElasticJobCongfig {
	// 连接Zookeeper
	@Bean(name = "coordinatorRegistryCenter")
    public static CoordinatorRegistryCenter createRegistryCenter() {
    	ZookeeperConfiguration zkConfig=new ZookeeperConfiguration("localhost:2181", "my-job");
        CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(zkConfig);
        regCenter.init();
        return regCenter;
    }
}
